﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterAdmin.master"  enableEventValidation="true" CodeFile="UsuarioForm.aspx.cs" Inherits="AreaRestrita_UsuarioForm" %>

<asp:Content ID="Content2" ContentPlaceHolderID="cphTitulo" runat="server">

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphPagina" runat="server">
    <asp:ScriptManager ID="sm1" runat="server">
</asp:ScriptManager>
    <asp:UpdatePanel ID="upAutomovel" Visible="true" runat="server">
        <ContentTemplate> 
        <div id="stylized" class="myform">
           <h1>Usuarios</h1>
           <p>Cadastro de usuarios</p>
           
           <label>Nome<span class="small"> Nome Completo</span></label>
                <asp:TextBox ID="txtNome" runat="Server"  CssClass="input" ></asp:TextBox>
                      
           <label>Email<span class="small"> Seu Email</span></label>              
                <asp:TextBox ID="txtEmail" runat="Server" CssClass="input"></asp:TextBox>    
             <label>Senha<span class="small"> Senha Complexa</span></label>       
              <asp:TextBox ID="txtSenha" runat="Server" TextMode="Password" CssClass="input"></asp:TextBox>
              <label>Confirmacao<span class="small"> Confirmar</span></label>     
                <asp:TextBox ID="txtSenhaConfirmacao" runat="Server" TextMode="Password" CssClass="input"></asp:TextBox>
                     <label>Ativo<span class="small">Clique para ativar </span></label>     
                        <asp:CheckBox ID="chkAtivo"  runat="server"  Text=""  CssClass="input" />
                     <label>Permissao<span class="small"> Escolha a Permissao</span></label>
                        <asp:DropDownList ID="ddlPermissao" runat="server" CssClass="input"></asp:DropDownList>
                        <asp:Button Text="Salvar" ID="btnSalvar" runat="server" onclick="btnSalvar_Click" CssClass="button"  ValidationGroup="form" />

                        <!-- Required Fields-->
                        <asp:RequiredFieldValidator runat="server" Display="None" ErrorMessage="O campo Nome é obrigatorio!" ID="reqNome" SetFocusOnError="true" ControlToValidate="txtNome" ValidationGroup="form"></asp:RequiredFieldValidator>
                        <asp:RequiredFieldValidator runat="server" Display="None" ErrorMessage="O campo Email é obrigatorio!" ID="reqEmail" SetFocusOnError="true" ControlToValidate="txtEmail" ValidationGroup="form"></asp:RequiredFieldValidator>
                        <asp:RequiredFieldValidator runat="server" Display="None" ErrorMessage="O campo Senha é obrigatorio!" ID="reqSenha" SetFocusOnError="true" ControlToValidate="txtSenha" ValidationGroup="form"></asp:RequiredFieldValidator>
                        <asp:RequiredFieldValidator runat="server" Display="None" ErrorMessage="O campo Confirmação é obrigatorio!" ID="reqConf" SetFocusOnError="true" ControlToValidate="txtSenhaConfirmacao" ValidationGroup="form"></asp:RequiredFieldValidator>

                        <asp:RegularExpressionValidator ID="RegEmail" runat="server" 
                ControlToValidate="txtEmail" Display="None" ErrorMessage="Email Inválido" 
                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                ValidationGroup="form"></asp:RegularExpressionValidator>

                        <asp:ValidationSummary DisplayMode="BulletList" runat="server" ShowMessageBox="true" ValidationGroup="form"  ShowSummary="false" />  
                
                <asp:CustomValidator ID="CusEmail" runat="server" 
                ControlToValidate="txtEmail" Display="none"  ValidateEmptyText="false" Text="problema" ErrorMessage="Email já cadastrado" 
                ValidationGroup="form" OnServerValidate="ValidaEmail"></asp:CustomValidator>
            <asp:CompareValidator ID="comSenha" runat="server" 
                ControlToCompare="txtSenhaConfirmacao" ControlToValidate="txtSenha" 
                Display="None" ErrorMessage="A Senha não Confere" ValidationGroup="form"></asp:CompareValidator>
                
                </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:HiddenField ID="hdfID" runat="server" />
</asp:Content>

